package service;

import java.util.List;

import beans.RepairBean;
import db.RepairDAO;

public class RepairService {

	public List<RepairBean> browse() {
		RepairDAO dao = new RepairDAO();
		return dao.getAllRecords();
	}

	public boolean addRepair(RepairBean user) {
		RepairDAO userDao = new RepairDAO();
		return userDao.insertRecord(user);
	}

	public int delRepair(RepairBean user) {
		RepairDAO userDao = new RepairDAO();
		if (userDao.deleteRecord(user))
			return 1;
		else
			return 2;
	}

	public boolean editRepair(RepairBean beforeRecord, RepairBean afterRecord) {
		RepairDAO userDao = new RepairDAO();
		return userDao.updateRecord(beforeRecord, afterRecord);
	}
}
